DB/room

1
2
3
Error:(12, 17) 警告: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.
Error:(21, 27) 错误: To use RxJava2 features, you must add `rxjava2` artifact from Room as a dependency. android.arch.persistence.room:rxjava2:<version>

解决方案

  1. 在创建DataBase 是加上{exportSchema = false}
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    @Database(entities = {Wait.class},version = 1, exportSchema = false)
    public abstract class WaitDataBase extends RoomDatabase {
    private static WaitDataBase sInstance;
    public static WaitDataBase getDatabase() {
    if (sInstance == null) {
    sInstance = Room.databaseBuilder(ReadhubApplication.getInstance(), WaitDataBase.class,
    "Readhub").build();
    }
    return sInstance;
    }
    public static void onDestroy() {
    sInstance = null;
    }
    public abstract WaitDao waitDao();
    }